package com.project.collectAPI.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.project.collectAPI.entity.Savedata;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * (Savedata)表数据库访问层
 *
 * @author makejava
 * @since 2023-06-13 11:26:36
 */
@Mapper
public interface SavedataDao extends BaseMapper<Savedata> {
    @MapKey("id")
    @Select("SELECT firstname,secondname,sbrand,createtime FROM savedata WHERE id IS NOT NULL AND sbrand=#{storeName} order by id desc LIMIT 0,1")
    Savedata getOne(@Param("storeName") String storeName);

    @MapKey("id")
    @Select("SELECT * FROM savedata WHERE firstname=#{mainName} AND secondname=#{className} AND sbrand=#{storeName} order by id desc LIMIT 0,#{Threshold}")
    List<Savedata> getList(@Param("storeName") String storeName,@Param("mainName") String mainName,@Param("className") String className,int Threshold);
}

